from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.widget import Widget
from kivy.properties import ObjectProperty
from kivy.graphics import Rectangle
from kivy.graphics import Color

class Touch(Widget):

    btn = ObjectProperty(None)  #change the opacity

    def on_touch_down(self, touch):
        print("Mouse Down", touch)  # it can get the position
        self.btn.opacity = 0.5  #change the opacity

    def on_touch_move(self, touch):
        print("Mouse Move", touch)

    def on_touch_up(self, touch):
        print("Mouse Up", touch)
        self.btn.opacity = 1  #change the opacity

class MYfloatApp(App):
    def build(self):
        #return FloatLayout()
        return Touch()

if __name__ == "__main__":
    MYfloatApp().run()